Skip to content

improve performance of schema and position lookups during feature decoding#560

Open
cportele wants to merge 1 commit into
masterfrom
memoize-lookups
Open

improve performance of schema and position lookups during feature decoding#560
cportele wants to merge 1 commit into
masterfrom
memoize-lookups

Conversation

@cportele

Copy link
Copy Markdown
Contributor

The decoding context exposes schema(), pos(), parentPos() and parentSchemas() as @Value.Lazy, but @Value.Lazy is not cached on a @Value.Modifiable, so each call re-resolved the per-path lookups - a map lookup keyed by the path list - on the schema mapping.

Memoize the lookups on the context, keyed by a version counter on the path tracker that changes whenever the tracked path changes:

  • FeaturePathTracker gains a version counter and isEmpty();
  • the four accessors delegate to overridable per-path lookups that the modifiable context resolves once per path and reuses.

The real mapping getters are still called, so dynamic schema transformers remain in effect; output is unchanged.

…oding

The decoding context exposes schema(), pos(), parentPos() and
parentSchemas() as @Value.Lazy, but @Value.Lazy is not cached on a
@Value.Modifiable, so each call re-resolved the per-path lookups - a map
lookup keyed by the path list - on the schema mapping.

Memoize the lookups on the context, keyed by a version counter on the path
tracker that changes whenever the tracked path changes:

- FeaturePathTracker gains a version counter and isEmpty();
- the four accessors delegate to overridable per-path lookups that the
  modifiable context resolves once per path and reuses.

The real mapping getters are still called, so dynamic schema transformers
remain in effect; output is unchanged.
@cportele cportele requested a review from azahnen as a code owner June 29, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant